package boardGet;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;

public class GUI extends JFrame {

	
	
	GUI() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException{
		UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		makeLayout();
		setDefaultCloseOperation(this.EXIT_ON_CLOSE);
		setTitle("掲示板");
		setSize(800, 600);
		setLocationRelativeTo(null);
		setVisible(true);
	}
	
	private void makeLayout() {
		
		DefaultMutableTreeNode nRoot = new DefaultMutableTreeNode("掲示板");
		DefaultMutableTreeNode board1 = new DefaultMutableTreeNode("掲示板");
		DefaultMutableTreeNode board2 = new DefaultMutableTreeNode("掲示板");
		DefaultMutableTreeNode board3 = new DefaultMutableTreeNode("掲示板");
		DefaultMutableTreeNode board4 = new DefaultMutableTreeNode("掲示板");
		JTree tree = new JTree(nRoot);
		tree.setToggleClickCount(1);
		nRoot.add(board1);
		board1.add(board2);
		nRoot.add(board3);
		board3.add(board4);
		tree.expandRow(0);
		tree.expandRow(2);
		
		String[] data = {"スタブ１","スタブ２","スタブ３","スタブ４","スタブ５","スタブ６","スタブ７","スタブ８","スタブ９"};
		JList list = new JList(data);
		JScrollPane scrolllist = new JScrollPane(list);
		scrolllist.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
		
		JTextArea text = new JTextArea("スタブ");
		text.setEditable(false);
		text.setLineWrap(true);
		JScrollPane scrolltext = new JScrollPane(text);
		scrolltext.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
		scrolltext.setPreferredSize(new Dimension(400, 400));
		
		JSplitPane horisplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
		horisplit.setDividerSize(5);
		horisplit.setDividerLocation(150);
		JSplitPane versplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
		versplit.setDividerSize(5);
		versplit.setDividerLocation(200);
		
		versplit.setTopComponent(scrolllist);
		versplit.setBottomComponent(scrolltext);
		horisplit.setLeftComponent(tree);
		horisplit.setRightComponent(versplit);
		
		getContentPane().add(horisplit);		
	}

	public static void main(String args[]) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException{
		new	GUI();
	}
}
